package com.typhoon.dao;

import com.typhoon.entity.User;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.jooq.DSLContext;
import org.jooq.Record;
import org.jooq.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

@Repository
public class User4Dao {

    @Autowired
    private DSLContext dslContext;

    public List<User> findAll() {
        List<User> list = this.dslContext.select()
               .from("User")
               .fetch()
               .map(record -> record.into(User.class));
       return list;
    }

}
